package com.lovo.buy.controller;

import com.lovo.utile.DTO.MovieDTO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
public class TicketingController {
    @Resource
    private RestTemplate restTemplate;

    @GetMapping("ticket")
    public String ticketing(@RequestBody MovieDTO movieDTO) {
//        MovieDTO movieDTO=new MovieDTO();
//        movieDTO.setName(name);
//        movieDTO.setNum(num);
        String result=
                restTemplate.postForEntity
                        ("http://localhost:8088/buy",movieDTO,String.class).getBody();
        return result;

    }

}
